package com.suxin.netty.remoting;

import io.netty.channel.Channel;

import java.util.concurrent.ExecutorService;

/**
 * @author Tang
 * @classname RemotingServer
 * @description [  ]
 * @date 2022/12/8 23:35
 */
public interface RemotingServer extends RemotingService {

    /**
     * registerProcessor
     * @param code
     * @param processor
     * @param executor
     */
    void registerProcessor(final int code, NettyRequestProcessor processor, ExecutorService executor);

    /**
     * registerDefaultProcessor
     * @param processor
     * @param executor
     */
    void registerDefaultProcessor(NettyRequestProcessor processor,ExecutorService executor);

    /**
     * 同步执行
     * @param request
     * @param timeoutMillis
     * @return
     */
    RemotingCommand invokeSync(RemotingCommand request,long timeoutMillis);

    /**
     * 异步执行
     * @param request
     * @param timeoutMillis
     * @param callback
     * @return
     */
    RemotingCommand invokeAsync(RemotingCommand request,long timeoutMillis,InvokeCallback callback);

}
